package com.jwgf.fault;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class Fault implements Comparable<Fault> {
	public static SimpleDateFormat formatter = new SimpleDateFormat(
			"yyyy-MM-dd HH:mm:ss", Locale.CHINA);
	public String index;
	public long time;
	public String date;
	public String info;

	public Fault(int index, long time, String info) {
		this.index = "" + index;
		this.time = time;
		this.info = info;
		date = formatter.format(new Date(time));
	}

	@Override
	public int compareTo(Fault another) {
		if (time < another.time) {
			return 1;
		} else if (time > another.time) {
			return -1;
		} else {
			return 0;
		}
	}
}
